<template>
	<view class="helps">
		<view class="list-box">
			<view class="list" v-for="(item,index) of data" :key="index"
			@click="goPage('/pages/public/helps/help-detail/help-detail?id='+item.id)">
				<view class="list-left">
					<text>{{item.title}}</text>
				</view>
				<view class="list-right">
					<text class="iconfont icon-dayu"></text>
				</view>
			</view>
			<block-loading :status="status" :len="data.length"></block-loading>
		</view>
	</view>
</template>

<script>
	import {getHelps} from "@/api/entrance.js"
	export default{
		name:'helps',
		data(){
			return{
				data:[],
				status: "loading",
				page: 1,
			}
		},
		onLoad() {
			this.getData()
		},
		onReachBottom(){
			this.getData();
		},
		methods:{
			goPage(url){
				uni.navigateTo({
					url:url
				})
			},
			async getData(){
				let res = await getHelps({page:this.page,size:20});
				if(this.page===1&&res.data.length === 0){
					this.status = "nodata"
					return
				}
				if(this.page===1&&res.data.length > 0 && res.data.length < 20){
					this.status = "nomore"
				}
				if(res.data.length === 0){
					this.status = "nomore"
					return;
				}
				this.page++;
				this.data = this.data.concat(res.data);
			},
		}
	}
</script>

<style lang="less" scoped src="./helps.less">
</style>
